import { isDataValueHandlerExisted } from 'XrFrame/core/DataValue';
import {request,RequestConfig,HttpRequestMethod,LengyuHttpResponse,PageRequestParam,download,upload}  from '../utils/request'


export interface TakePeople{
  id?:string,
  userId?:string,
  userName?:string,
  vxOpenId?:string,
  need:string,
  playHours:number,
  gs:number,
  career:string,
  position:string,
  createTime?:string,
  updateTime?:string,
  self?:boolean
}

// 将微信用户信息保存到数据库
export function savePeople(takePeople:TakePeople): Promise<LengyuHttpResponse> {
  takePeople.vxOpenId=wx.getStorageSync('openId')
  takePeople.userId=wx.getStorageSync('userId')
  let requestConfig:RequestConfig={
    url:'/take-people/savePeople',
    method:HttpRequestMethod.POST,
    data:takePeople,
    token:true,
  }
  return request(requestConfig);
}


export function list(param:any): Promise<LengyuHttpResponse> {
  let requestConfig:RequestConfig={
    url:'/take-people/list',
    method:HttpRequestMethod.POST,
    data:param,
    token:true,
  }
  return request(requestConfig);
}

/**
 * 
 * @param ids  多个ID用,隔开
 */
export function doDelete(ids:string): Promise<LengyuHttpResponse> {
  let param={
    ids:ids
  }
  let requestConfig:RequestConfig={
    url:'/take-people/delete',
    method:HttpRequestMethod.POST,
    data:param,
    token:true,
  }
  return request(requestConfig);
}